package com.irdstudio.efp.flow.route.impl;

import org.mvel2.MVEL;
import org.springframework.stereotype.Service;

import com.irdstudio.efp.flow.common.vo.EngineVO;
import com.irdstudio.efp.flow.executor.RoutePluginExecutor;
import com.irdstudio.efp.flow.service.vo.BizFlowRouteVO;
import com.irdstudio.basic.framework.core.util.StringUtil;

/**
 * 
 * 默认的表达式执行器
 * 
 * @author Cytus_
 * @since 2018年6月1日 下午7:53:31
 * @version 1.0
 *
 */
@Deprecated
@Service("defaultRouteExpressionExecutor")
public class DefaultRouteExpressionExecutor implements RoutePluginExecutor {

    public boolean judgeRoute(EngineVO evo, BizFlowRouteVO routeVo) {
        String expression = routeVo.getBizRouteScript();
        return StringUtil.isNotEmpty(expression) ? MVEL.evalToBoolean(expression, evo.getPluginVo().getVos()) : false;
    }

    public boolean isDefault(BizFlowRouteVO routeVo) {
        return StringUtil.isNotEmpty(routeVo.getBizRouteScript());
    }

}
